import React, { Component } from 'react';
import {
    View,
    Text,
    Image,
    ListView,
    TouchableOpacity,
    Alert,
    ScrollView,
    RefreshControl,                         //刷新小组件
    ActivityIndicator                       //底部刷新小组件
} from 'react-native';

import { public_Style as styles } from '../../../styles';

const ds = new ListView.DataSource({ rowHasChanged: (r1, r2) => { r1 !== r2 } });//listView 数据判断方式
export default class Tradelist extends Component {
    // 初始化模拟数据
    constructor(props) {
        super(props);
    }

    render() {
        //创建listView数据源
        const dataSource = ds.cloneWithRows(this.props.fields);
        return (
            <View style={styles.tra_area}>
                <ListView
                    dataSource={dataSource}
                    renderRow={this.renderRow.bind(this)}
                    contentContainerStyle={styles.listtrade}
                    enableEmptySections={true}
                />
            </View>
        );
    }

    renderRow(rowData) {
        return (
            <TouchableOpacity
                onPress={() => {
                    this.props.deleHY(rowData.fieldId);
                }}>
                <Text style={styles.tradetext2}>
                    {rowData.fieldName}
                </Text>
            </TouchableOpacity>
        )
    }
}